/**
 **************************************************************************************************************************
 * 
 **************************************************************************************************************************
 * @file RBD3D11Mappings.h
 **************************************************************************************************************************/

#pragma once

#ifdef  HEADER_MSG
#pragma HEADER_MSG(RBD3D11Mappings.h)
#endif


/**************************************************************************************************************************
 * Includes
 **************************************************************************************************************************/
#include <d3d11.h>
#include "RBMain/RBVertexElement.h"

/**************************************************************************************************************************
 * Forward declarations
 **************************************************************************************************************************/


/**************************************************************************************************************************
 * Classes
 **************************************************************************************************************************/
namespace RBD3D11Mappings
{
    static inline DXGI_FORMAT GetD3D11PixelFormat (RBPixelFormat eFormat)
    {
        switch (eFormat)
        {
        case PF_UNKNOWN: return DXGI_FORMAT_UNKNOWN;
        case PF_R32G32B32A32_TYPELESS: return DXGI_FORMAT_R32G32B32A32_TYPELESS;
        case PF_R32G32B32A32_FLOAT: return DXGI_FORMAT_R32G32B32A32_FLOAT;
        case PF_R32G32B32A32_UINT: return DXGI_FORMAT_R32G32B32A32_UINT;
        case PF_R32G32B32A32_SINT: return DXGI_FORMAT_R32G32B32A32_SINT;
        case PF_R32G32B32_TYPELESS: return DXGI_FORMAT_R32G32B32_TYPELESS;
        case PF_R32G32B32_FLOAT: return DXGI_FORMAT_R32G32B32_FLOAT;
        case PF_R32G32B32_UINT: return DXGI_FORMAT_R32G32B32_UINT;
        case PF_R32G32B32_SINT: return DXGI_FORMAT_R32G32B32_SINT;
        case PF_R16G16B16A16_TYPELESS: return DXGI_FORMAT_R16G16B16A16_TYPELESS;
        case PF_R16G16B16A16_FLOAT: return DXGI_FORMAT_R16G16B16A16_FLOAT;
        case PF_R16G16B16A16_UNORM: return DXGI_FORMAT_R16G16B16A16_UNORM;
        case PF_R16G16B16A16_UINT: return DXGI_FORMAT_R16G16B16A16_UINT;
        case PF_R16G16B16A16_SNORM: return DXGI_FORMAT_R16G16B16A16_SNORM;
        case PF_R16G16B16A16_SINT: return DXGI_FORMAT_R16G16B16A16_SINT;
        case PF_R32G32_TYPELESS: return DXGI_FORMAT_R32G32_TYPELESS;
        case PF_R32G32_FLOAT: return DXGI_FORMAT_R32G32_FLOAT;
        case PF_R32G32_UINT: return DXGI_FORMAT_R32G32_UINT;
        case PF_R32G32_SINT: return DXGI_FORMAT_R32G32_SINT;
        case PF_R32G8X24_TYPELESS: return DXGI_FORMAT_R32G8X24_TYPELESS;
        case PF_D32_FLOAT_S8X24_UINT: return DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
        case PF_R32_FLOAT_X8X24_TYPELESS: return DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS;
        case PF_X32_TYPELESS_G8X24_UINT: return DXGI_FORMAT_X32_TYPELESS_G8X24_UINT;
        case PF_R10G10B10A2_TYPELESS: return DXGI_FORMAT_R10G10B10A2_TYPELESS;
        case PF_R10G10B10A2_UNORM: return DXGI_FORMAT_R10G10B10A2_UNORM;
        case PF_R10G10B10A2_UINT: return DXGI_FORMAT_R10G10B10A2_UINT;
        case PF_R11G11B10_FLOAT: return DXGI_FORMAT_R11G11B10_FLOAT;
        case PF_R8G8B8A8_TYPELESS: return DXGI_FORMAT_R8G8B8A8_TYPELESS;
        case PF_R8G8B8A8_UNORM: return DXGI_FORMAT_R8G8B8A8_UNORM;
        case PF_R8G8B8A8_UNORM_SRGB: return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
        case PF_R8G8B8A8_UINT: return DXGI_FORMAT_R8G8B8A8_UINT;
        case PF_R8G8B8A8_SNORM: return DXGI_FORMAT_R8G8B8A8_SNORM;
        case PF_R8G8B8A8_SINT: return DXGI_FORMAT_R8G8B8A8_SINT;
        case PF_R16G16_TYPELESS: return DXGI_FORMAT_R16G16_TYPELESS;
        case PF_R16G16_FLOAT: return DXGI_FORMAT_R16G16_FLOAT;
        case PF_R16G16_UNORM: return DXGI_FORMAT_R16G16_UNORM;
        case PF_R16G16_UINT: return DXGI_FORMAT_R16G16_UINT;
        case PF_R16G16_SNORM: return DXGI_FORMAT_R16G16_SNORM;
        case PF_R16G16_SINT: return DXGI_FORMAT_R16G16_SINT;
        case PF_R32_TYPELESS: return DXGI_FORMAT_R32_TYPELESS;
        case PF_D32_FLOAT: return DXGI_FORMAT_D32_FLOAT;
        case PF_R32_FLOAT: return DXGI_FORMAT_R32_FLOAT;
        case PF_R32_UINT: return DXGI_FORMAT_R32_UINT;
        case PF_R32_SINT: return DXGI_FORMAT_R32_SINT;
        case PF_R24G8_TYPELESS: return DXGI_FORMAT_R24G8_TYPELESS;
        case PF_D24_UNORM_S8_UINT: return DXGI_FORMAT_D24_UNORM_S8_UINT;
        case PF_R24_UNORM_X8_TYPELESS: return DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
        case PF_X24_TYPELESS_G8_UINT: return DXGI_FORMAT_X24_TYPELESS_G8_UINT;
        case PF_R8G8_TYPELESS: return DXGI_FORMAT_R8G8_TYPELESS;
        case PF_R8G8_UNORM: return DXGI_FORMAT_R8G8_UNORM;
        case PF_R8G8_UINT: return DXGI_FORMAT_R8G8_UINT;
        case PF_R8G8_SNORM: return DXGI_FORMAT_R8G8_SNORM;
        case PF_R8G8_SINT: return DXGI_FORMAT_R8G8_SINT;
        case PF_R16_TYPELESS: return DXGI_FORMAT_R16_TYPELESS;
        case PF_R16_FLOAT: return DXGI_FORMAT_R16_FLOAT;
        case PF_D16_UNORM: return DXGI_FORMAT_D16_UNORM;
        case PF_R16_UNORM: return DXGI_FORMAT_R16_UNORM;
        case PF_R16_UINT: return DXGI_FORMAT_R16_UINT;
        case PF_R16_SNORM: return DXGI_FORMAT_R16_SNORM;
        case PF_R16_SINT: return DXGI_FORMAT_R16_SINT;
        case PF_R8_TYPELESS: return DXGI_FORMAT_R8_TYPELESS;
        case PF_R8_UNORM: return DXGI_FORMAT_R8_UNORM;
        case PF_R8_UINT: return DXGI_FORMAT_R8_UINT;
        case PF_R8_SNORM: return DXGI_FORMAT_R8_SNORM;
        case PF_R8_SINT: return DXGI_FORMAT_R8_SINT;
        case PF_A8_UNORM: return DXGI_FORMAT_A8_UNORM;
        case PF_R1_UNORM: return DXGI_FORMAT_R1_UNORM;
        case PF_R9G9B9E5_SHAREDEXP: return DXGI_FORMAT_R9G9B9E5_SHAREDEXP;
        case PF_R8G8_B8G8_UNORM: return DXGI_FORMAT_R8G8_B8G8_UNORM;
        case PF_G8R8_G8B8_UNORM: return DXGI_FORMAT_G8R8_G8B8_UNORM;
        case PF_BC1_TYPELESS: return DXGI_FORMAT_BC1_TYPELESS;
        case PF_BC1_UNORM: return DXGI_FORMAT_BC1_UNORM;
        case PF_BC1_UNORM_SRGB: return DXGI_FORMAT_BC1_UNORM_SRGB;
        case PF_BC2_TYPELESS: return DXGI_FORMAT_BC2_TYPELESS;
        case PF_BC2_UNORM: return DXGI_FORMAT_BC2_UNORM;
        case PF_BC2_UNORM_SRGB: return DXGI_FORMAT_BC2_UNORM_SRGB;
        case PF_BC3_TYPELESS: return DXGI_FORMAT_BC3_TYPELESS;
        case PF_BC3_UNORM: return DXGI_FORMAT_BC3_UNORM;
        case PF_BC3_UNORM_SRGB: return DXGI_FORMAT_BC3_UNORM_SRGB;
        case PF_BC4_TYPELESS: return DXGI_FORMAT_BC4_TYPELESS;
        case PF_BC4_UNORM: return DXGI_FORMAT_BC4_UNORM;
        case PF_BC4_SNORM: return DXGI_FORMAT_BC4_SNORM;
        case PF_BC5_TYPELESS: return DXGI_FORMAT_BC5_TYPELESS;
        case PF_BC5_UNORM: return DXGI_FORMAT_BC5_UNORM;
        case PF_BC5_SNORM: return DXGI_FORMAT_BC5_SNORM;
        case PF_B5G6R5_UNORM: return DXGI_FORMAT_B5G6R5_UNORM;
        case PF_B5G5R5A1_UNORM: return DXGI_FORMAT_B5G5R5A1_UNORM;
        case PF_B8G8R8A8_UNORM: return DXGI_FORMAT_B8G8R8A8_UNORM;
        case PF_B8G8R8X8_UNORM: return DXGI_FORMAT_B8G8R8X8_UNORM;
        case PF_R10G10B10_XR_BIAS_A2_UNORM: return DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM;
        case PF_B8G8R8A8_TYPELESS: return DXGI_FORMAT_B8G8R8A8_TYPELESS;
        case PF_B8G8R8A8_UNORM_SRGB: return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
        case PF_B8G8R8X8_TYPELESS: return DXGI_FORMAT_B8G8R8X8_TYPELESS;
        case PF_B8G8R8X8_UNORM_SRGB: return DXGI_FORMAT_B8G8R8X8_UNORM_SRGB;
        case PF_BC6H_TYPELESS: return DXGI_FORMAT_BC6H_TYPELESS;
        case PF_BC6H_UF16: return DXGI_FORMAT_BC6H_UF16;
        case PF_BC6H_SF16: return DXGI_FORMAT_BC6H_SF16;
        case PF_BC7_TYPELESS: return DXGI_FORMAT_BC7_TYPELESS;
        case PF_BC7_UNORM: return DXGI_FORMAT_BC7_UNORM;
        case PF_BC7_UNORM_SRGB: return DXGI_FORMAT_BC7_UNORM_SRGB;
        case PF_FORCE_UINT: return DXGI_FORMAT_FORCE_UINT;
        default: return DXGI_FORMAT_UNKNOWN;
        }
    }

    static inline RBPixelFormat GetRBPixelFormat (DXGI_FORMAT eFormat)
    {
        switch (eFormat)
        {
        case DXGI_FORMAT_UNKNOWN: return PF_UNKNOWN;
        case DXGI_FORMAT_R32G32B32A32_TYPELESS: return PF_R32G32B32A32_TYPELESS;
        case DXGI_FORMAT_R32G32B32A32_FLOAT: return PF_R32G32B32A32_FLOAT;
        case DXGI_FORMAT_R32G32B32A32_UINT: return PF_R32G32B32A32_UINT;
        case DXGI_FORMAT_R32G32B32A32_SINT: return PF_R32G32B32A32_SINT;
        case DXGI_FORMAT_R32G32B32_TYPELESS: return PF_R32G32B32_TYPELESS;
        case DXGI_FORMAT_R32G32B32_FLOAT: return PF_R32G32B32_FLOAT;
        case DXGI_FORMAT_R32G32B32_UINT: return PF_R32G32B32_UINT;
        case DXGI_FORMAT_R32G32B32_SINT: return PF_R32G32B32_SINT;
        case DXGI_FORMAT_R16G16B16A16_TYPELESS: return PF_R16G16B16A16_TYPELESS;
        case DXGI_FORMAT_R16G16B16A16_FLOAT: return PF_R16G16B16A16_FLOAT;
        case DXGI_FORMAT_R16G16B16A16_UNORM: return PF_R16G16B16A16_UNORM;
        case DXGI_FORMAT_R16G16B16A16_UINT: return PF_R16G16B16A16_UINT;
        case DXGI_FORMAT_R16G16B16A16_SNORM: return PF_R16G16B16A16_SNORM;
        case DXGI_FORMAT_R16G16B16A16_SINT: return PF_R16G16B16A16_SINT;
        case DXGI_FORMAT_R32G32_TYPELESS: return PF_R32G32_TYPELESS;
        case DXGI_FORMAT_R32G32_FLOAT: return PF_R32G32_FLOAT;
        case DXGI_FORMAT_R32G32_UINT: return PF_R32G32_UINT;
        case DXGI_FORMAT_R32G32_SINT: return PF_R32G32_SINT;
        case DXGI_FORMAT_R32G8X24_TYPELESS: return PF_R32G8X24_TYPELESS;
        case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: return PF_D32_FLOAT_S8X24_UINT;
        case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS: return PF_R32_FLOAT_X8X24_TYPELESS;
        case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT: return PF_X32_TYPELESS_G8X24_UINT;
        case DXGI_FORMAT_R10G10B10A2_TYPELESS: return PF_R10G10B10A2_TYPELESS;
        case DXGI_FORMAT_R10G10B10A2_UNORM: return PF_R10G10B10A2_UNORM;
        case DXGI_FORMAT_R10G10B10A2_UINT: return PF_R10G10B10A2_UINT;
        case DXGI_FORMAT_R11G11B10_FLOAT: return PF_R11G11B10_FLOAT;
        case DXGI_FORMAT_R8G8B8A8_TYPELESS: return PF_R8G8B8A8_TYPELESS;
        case DXGI_FORMAT_R8G8B8A8_UNORM: return PF_R8G8B8A8_UNORM;
        case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: return PF_R8G8B8A8_UNORM_SRGB;
        case DXGI_FORMAT_R8G8B8A8_UINT: return PF_R8G8B8A8_UINT;
        case DXGI_FORMAT_R8G8B8A8_SNORM: return PF_R8G8B8A8_SNORM;
        case DXGI_FORMAT_R8G8B8A8_SINT: return PF_R8G8B8A8_SINT;
        case DXGI_FORMAT_R16G16_TYPELESS: return PF_R16G16_TYPELESS;
        case DXGI_FORMAT_R16G16_FLOAT: return PF_R16G16_FLOAT;
        case DXGI_FORMAT_R16G16_UNORM: return PF_R16G16_UNORM;
        case DXGI_FORMAT_R16G16_UINT: return PF_R16G16_UINT;
        case DXGI_FORMAT_R16G16_SNORM: return PF_R16G16_SNORM;
        case DXGI_FORMAT_R16G16_SINT: return PF_R16G16_SINT;
        case DXGI_FORMAT_R32_TYPELESS: return PF_R32_TYPELESS;
        case DXGI_FORMAT_D32_FLOAT: return PF_D32_FLOAT;
        case DXGI_FORMAT_R32_FLOAT: return PF_R32_FLOAT;
        case DXGI_FORMAT_R32_UINT: return PF_R32_UINT;
        case DXGI_FORMAT_R32_SINT: return PF_R32_SINT;
        case DXGI_FORMAT_R24G8_TYPELESS: return PF_R24G8_TYPELESS;
        case DXGI_FORMAT_D24_UNORM_S8_UINT: return PF_D24_UNORM_S8_UINT;
        case DXGI_FORMAT_R24_UNORM_X8_TYPELESS: return PF_R24_UNORM_X8_TYPELESS;
        case DXGI_FORMAT_X24_TYPELESS_G8_UINT: return PF_X24_TYPELESS_G8_UINT;
        case DXGI_FORMAT_R8G8_TYPELESS: return PF_R8G8_TYPELESS;
        case DXGI_FORMAT_R8G8_UNORM: return PF_R8G8_UNORM;
        case DXGI_FORMAT_R8G8_UINT: return PF_R8G8_UINT;
        case DXGI_FORMAT_R8G8_SNORM: return PF_R8G8_SNORM;
        case DXGI_FORMAT_R8G8_SINT: return PF_R8G8_SINT;
        case DXGI_FORMAT_R16_TYPELESS: return PF_R16_TYPELESS;
        case DXGI_FORMAT_R16_FLOAT: return PF_R16_FLOAT;
        case DXGI_FORMAT_D16_UNORM: return PF_D16_UNORM;
        case DXGI_FORMAT_R16_UNORM: return PF_R16_UNORM;
        case DXGI_FORMAT_R16_UINT: return PF_R16_UINT;
        case DXGI_FORMAT_R16_SNORM: return PF_R16_SNORM;
        case DXGI_FORMAT_R16_SINT: return PF_R16_SINT;
        case DXGI_FORMAT_R8_TYPELESS: return PF_R8_TYPELESS;
        case DXGI_FORMAT_R8_UNORM: return PF_R8_UNORM;
        case DXGI_FORMAT_R8_UINT: return PF_R8_UINT;
        case DXGI_FORMAT_R8_SNORM: return PF_R8_SNORM;
        case DXGI_FORMAT_R8_SINT: return PF_R8_SINT;
        case DXGI_FORMAT_A8_UNORM: return PF_A8_UNORM;
        case DXGI_FORMAT_R1_UNORM: return PF_R1_UNORM;
        case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: return PF_R9G9B9E5_SHAREDEXP;
        case DXGI_FORMAT_R8G8_B8G8_UNORM: return PF_R8G8_B8G8_UNORM;
        case DXGI_FORMAT_G8R8_G8B8_UNORM: return PF_G8R8_G8B8_UNORM;
        case DXGI_FORMAT_BC1_TYPELESS: return PF_BC1_TYPELESS;
        case DXGI_FORMAT_BC1_UNORM: return PF_BC1_UNORM;
        case DXGI_FORMAT_BC1_UNORM_SRGB: return PF_BC1_UNORM_SRGB;
        case DXGI_FORMAT_BC2_TYPELESS: return PF_BC2_TYPELESS;
        case DXGI_FORMAT_BC2_UNORM: return PF_BC2_UNORM;
        case DXGI_FORMAT_BC2_UNORM_SRGB: return PF_BC2_UNORM_SRGB;
        case DXGI_FORMAT_BC3_TYPELESS: return PF_BC3_TYPELESS;
        case DXGI_FORMAT_BC3_UNORM: return PF_BC3_UNORM;
        case DXGI_FORMAT_BC3_UNORM_SRGB: return PF_BC3_UNORM_SRGB;
        case DXGI_FORMAT_BC4_TYPELESS: return PF_BC4_TYPELESS;
        case DXGI_FORMAT_BC4_UNORM: return PF_BC4_UNORM;
        case DXGI_FORMAT_BC4_SNORM: return PF_BC4_SNORM;
        case DXGI_FORMAT_BC5_TYPELESS: return PF_BC5_TYPELESS;
        case DXGI_FORMAT_BC5_UNORM: return PF_BC5_UNORM;
        case DXGI_FORMAT_BC5_SNORM: return PF_BC5_SNORM;
        case DXGI_FORMAT_B5G6R5_UNORM: return PF_B5G6R5_UNORM;
        case DXGI_FORMAT_B5G5R5A1_UNORM: return PF_B5G5R5A1_UNORM;
        case DXGI_FORMAT_B8G8R8A8_UNORM: return PF_B8G8R8A8_UNORM;
        case DXGI_FORMAT_B8G8R8X8_UNORM: return PF_B8G8R8X8_UNORM;
        case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: return PF_R10G10B10_XR_BIAS_A2_UNORM;
        case DXGI_FORMAT_B8G8R8A8_TYPELESS: return PF_B8G8R8A8_TYPELESS;
        case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: return PF_B8G8R8A8_UNORM_SRGB;
        case DXGI_FORMAT_B8G8R8X8_TYPELESS: return PF_B8G8R8X8_TYPELESS;
        case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: return PF_B8G8R8X8_UNORM_SRGB;
        case DXGI_FORMAT_BC6H_TYPELESS: return PF_BC6H_TYPELESS;
        case DXGI_FORMAT_BC6H_UF16: return PF_BC6H_UF16;
        case DXGI_FORMAT_BC6H_SF16: return PF_BC6H_SF16;
        case DXGI_FORMAT_BC7_TYPELESS: return PF_BC7_TYPELESS;
        case DXGI_FORMAT_BC7_UNORM: return PF_BC7_UNORM;
        case DXGI_FORMAT_BC7_UNORM_SRGB: return PF_BC7_UNORM_SRGB;
        case DXGI_FORMAT_FORCE_UINT: return PF_FORCE_UINT;
        default: return PF_UNKNOWN;
        }
    }

    static inline UINT GetD3D11BindFlags(uint32 uiUsage)
    {
        UINT d3dBindFlags = 0;
        if (rb_hw_buffer_usage::HBU_DEPTHSTENCIL & uiUsage) d3dBindFlags |= D3D11_BIND_DEPTH_STENCIL;
        if (rb_hw_buffer_usage::HBU_VERTEX_BUFFER & uiUsage) d3dBindFlags |= D3D11_BIND_VERTEX_BUFFER;
        if (rb_hw_buffer_usage::HBU_INDEX_BUFFER & uiUsage) d3dBindFlags |= D3D11_BIND_INDEX_BUFFER;
        if (rb_hw_buffer_usage::HBU_CONSTANT_BUFFER & uiUsage) d3dBindFlags |= D3D11_BIND_CONSTANT_BUFFER;
        if (rb_hw_buffer_usage::HBU_SHADER_RESOURCE & uiUsage) d3dBindFlags |= D3D11_BIND_SHADER_RESOURCE;
        if (rb_hw_buffer_usage::HBU_RENDER_TARGET & uiUsage) d3dBindFlags |= D3D11_BIND_RENDER_TARGET;

        return d3dBindFlags;
    }

    static inline D3D11_USAGE get_d3d_usage(uint32 uiUsage)
    {
        if (rb_hw_buffer_usage::HBU_CPUREAD & uiUsage) return D3D11_USAGE_STAGING;			// RW CPU/GPU
        if (rb_hw_buffer_usage::HBU_CPUWRITE & uiUsage) return D3D11_USAGE_DYNAMIC;			// W CPU / R GPU
        if (!(rb_hw_buffer_usage::HBU_GPUWRITE & uiUsage)) return D3D11_USAGE_IMMUTABLE;		// R GPU
        return D3D11_USAGE_DEFAULT;															// RW GPU
    }

    static inline UINT get_d3d_misc_flags(uint32 uiUsage, RBTextureType::EType tex_type)
    {
        UINT flags = 0;
        if (uiUsage & rb_hw_buffer_usage::HBU_SHARED) flags |= D3D11_RESOURCE_MISC_SHARED;
        if (tex_type == RBTextureType::CUBE) flags |= D3D11_RESOURCE_MISC_TEXTURECUBE;
        return flags;
    }

    static inline UINT get_d3d_cpu_access_flags(uint32 uiUsage)
    {
        UINT flags=0;
        if (rb_hw_buffer_usage::HBU_CPUREAD & uiUsage) flags|= D3D11_CPU_ACCESS_READ;			
        if (rb_hw_buffer_usage::HBU_CPUWRITE & uiUsage) flags|= D3D11_CPU_ACCESS_WRITE;		
        return flags;															
    }

    static inline DXGI_FORMAT GetD3D11Format(RBVertexElement::EType eType)
    {
        switch (eType)
        {
        case RBVertexElement::VET_FLOAT1: return DXGI_FORMAT_R32_FLOAT;
        case RBVertexElement::VET_FLOAT2: return DXGI_FORMAT_R32G32_FLOAT;
        case RBVertexElement::VET_FLOAT3: return DXGI_FORMAT_R32G32B32_FLOAT;
        case RBVertexElement::VET_FLOAT4: return DXGI_FORMAT_R32G32B32A32_FLOAT;
        case RBVertexElement::VET_D3DCOLOR: return DXGI_FORMAT_R8G8B8A8_UNORM;
        case RBVertexElement::VET_UBYTE4: return DXGI_FORMAT_R8G8B8A8_UINT;
        case RBVertexElement::VET_SHORT2: return DXGI_FORMAT_R16G16_FLOAT;
        case RBVertexElement::VET_SHORT4: return DXGI_FORMAT_R16G16B16A16_FLOAT;
        case RBVertexElement::VET_UBYTE4N: return DXGI_FORMAT_R8G8B8A8_UNORM;
        case RBVertexElement::VET_SHORT2N: return DXGI_FORMAT_R16G16_SNORM;
        case RBVertexElement::VET_SHORT4N: return DXGI_FORMAT_R16G16B16A16_SNORM;
        case RBVertexElement::VET_USHORT2N: return DXGI_FORMAT_R16G16_UNORM;
        case RBVertexElement::VET_USHORT4N: return DXGI_FORMAT_R16G16B16A16_UNORM;
        case RBVertexElement::VET_FLOAT16_2: return DXGI_FORMAT_R16G16_FLOAT;
        case RBVertexElement::VET_FLOAT16_4: return DXGI_FORMAT_R16G16B16A16_FLOAT;
        case RBVertexElement::VET_UNUSED: return DXGI_FORMAT_UNKNOWN;
        default: return DXGI_FORMAT_UNKNOWN;
        }

    }

}